<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>	
<%@ include file="/pub/headmeta.jsp" %>
</head>
<body>
	<div class="right-head"><span class="right-head-font">登入日志</span></div>
	
	<form id="queryForm" method="post">
	<div class="term">
		<div class="div1-2">登入帐号：</div>
		<div class="div2"><input type="text" name="q_account" id="q_account"/></div>
		<div class="div1-2">客户端IP：</div>		
		<div class="div2"><input type="text" name="q_custIp" id="q_custIp"/></div>
		<br style="clear:both;" /><br />
		
		<div class="div1-2">登入时间：</div>		
		<div class="div2"><input type="text" name="q_loginTime" id="q_loginTime" class="Wdate" onClick="WdatePicker()"/></div>
		<div class="div1-2">成功与否：</div>
		<div class="div2"><select class="div3" name="q_status" id="q_status"><option value="">-全部-</option><option value="0">成功</option><option value="1">失败</option></select></div>
		<br style="clear:both;" /><br />
	</div>
	<div class="function-bar">
		<div class="div0"><input type="button" class="button-bar" value="重置条件" onclick="resetEx(this.form);"/></div>
		<div class="div0"><input type="button" class="button-bar" value="查询" onclick="setCurPage(1);doQuery();"/></div>
	</div>	
	</form>
	
	<form id="delForm" method="post">
	<table id="MyTableList" width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table-form">
		<tr align="center" class="STYLE1">
			<th width="5%"><input id="ckAll" type="checkbox" onclick="checkAll(this.checked,'cb');" /></th>
			<th width="5%">序号</th>
			<th width="20%">登入帐号</th>
			<th width="25%">登入时间</th>				
			<th width="25%">客户端IP</th>
			<th width="20%">成功与否</th>
		</tr>
	</table>
	<%@ include file="/pub/pageLink.jsp" %>
	</form>
</body>
</html>
<script type="text/javascript">
<!--
var types;
//自动调用初始化
$(document).ready(function(){		
	//查询
	doQuery();
});

//查询
function doQuery(){	
	var page=getPage();
	var pageSize=getPageSize();
	var url="${ctx}/sys!getLoginLog.action?page="+page+"&pageSize="+pageSize;
	$.post(url, $("#queryForm").serialize() ,function callback(txt){   
			var json = $.parseJSON(txt);
			if (json.code==0) {	
				setRecordCount(json.count);
				createTable(json.info,page,pageSize);				
			}else{
				alert('查询失败！');
			}
		}	
	);
}

//创建表数据
function createTable(objs,page,pageSize){	
	var table=document.getElementById('MyTableList');
	for( var i=table.rows.length-1; i>0; i--){
		table.deleteRow(i); 
	}
	var b=document.createElement("tbody");
	for(var i=0;i<objs.length;i++){
		var obj=objs[i];
		var row=document.createElement("tr");	
		row.align="center";	
		
		var c1=document.createElement("td");	
		c1.innerHTML="<input name='cb' type='checkbox' value='"+obj.id+"'/>";
		var c2=document.createElement("td");	
		c2.innerHTML=(page-1)*pageSize+i+1;
		var c3=document.createElement("td");	
		c3.innerHTML=obj.account;	
		var c4=document.createElement("td");	
		c4.innerHTML=formatDate(obj.loginTime);
		var c5=document.createElement("td");	
		c5.innerHTML=obj.custIp;
		var c6=document.createElement("td");	
		c6.innerHTML=obj.status==0?"成功":"失败";		
				
		row.appendChild(c1);
		row.appendChild(c2);
		row.appendChild(c3);
		row.appendChild(c4);
		row.appendChild(c5);
		row.appendChild(c6);

		setTdStyle(row);
		b.appendChild(row);
	}
	table.appendChild(b);
}

//进入新增页面
function viewAdd(){
	location.href="${ctx}/role!viewAdd.action";
}
//编辑
function viewEdit(id){
	location.href="${ctx}/role!viewEdit.action?id="+id;
}
//-->
</script>
